package com.ls.fw.data.search.impl.lucene.util;

import java.text.ParseException;
import java.util.Calendar;
import java.util.Date;

public class DateUtil {

	private static long datetime = 24*60*60*1000L;

	public static int getDay(Date start,Date end){
		int day = 0;
		if(end.after(start)){
			day = (int) ((end.getTime()-start.getTime())/(datetime));
		}
		return day;
	}
	
	public static Calendar getNextDayDesc(Calendar end){
		return getNextDayDesc(end, 1);
	}
	
	public static Calendar getNextDayDesc(Calendar end,int step){
		Calendar date = Calendar.getInstance();
		date.setTime(end.getTime());
		date.add(Calendar.DAY_OF_MONTH,-step);
		return date;
	}
	
	public static void main(String[] args) throws ParseException {
		String s = "20141026",e="20151027";
	
//		System.out.println(LuceneUtil.getDay(start, end));
	}
}
